<template>
	<view>
		测试页面
		<view class="block" v-for="(item,index) in imgs" :key="index">
			<text>id: {{item.id}}</text>
			<view class="block-self" v-for="(selfitem,i) in item.imgsurl" :key="i">
				<image :src="selfitem" mode="widthFix" :data-src="selfitem" @tap="previewOpen($event, item.imgsurl)"></image>
			</view>
		</view>
		<previewImage ref="previewImage" :opacity="0.8" :circular="true" :imgs="currentimgs" @longPress="longPress"></previewImage>
	</view>
</template>

<script>
	import previewImage from '@/components/kxj-previewImage/kxj-previewImage.vue'; //引用插件
	export default {
		components:{
			previewImage
		},
		data() {
			return {
				imgs: [{
						id: 1,
						imgsurl: [
							'https://img1.sycdn.imooc.com/5ccfac620001f8d405000344.jpg',
							'https://img1.sycdn.imooc.com/5dc698450001a9f712760906.png'
						]
					},
					{
						id: 2,
						imgsurl: [
							'https://img1.sycdn.imooc.com/5dc698e400014cb711420915.png',
							'https://img1.sycdn.imooc.com/5dc6990d00013b0b16260978.png'
						]
					},
					{
						id: 3,
						imgsurl: [
							'https://img1.sycdn.imooc.com/5ccfac620001f8d405000344.jpg'
						]
					},
					{
						id: 4,
						imgsurl: [
							
						]
					}
				],
				currentimgs: []
			}
		},
		methods: {
			previewOpen(e, imgsarr){
				this.currentimgs = imgsarr
				var _this = this
				setTimeout(function(){
					var param = e.currentTarget.dataset.src
					_this.$refs.previewImage.open(param)
				}, 100)
				
				
			},
			longPress(){
				
			}
		}
	}
</script>

<style lang="scss">
	page{
		padding: 10rpx;
	}
.block{
	width: 100%;
	overflow: hidden;
	border: 1px solid gray;
	padding: 20rpx;
	box-sizing: border-box;
	box-shadow: 0 0 10rpx gray;
	margin-bottom: 20rpx;
	margin-top: 20rpx;
	.block-self{
		width: 100%;
		overflow: hidden;
		border: 1px solid red;
		padding: 20rpx;
		box-sizing: border-box;
		box-shadow: 0 0 10rpx orange;
		margin-bottom: 20rpx;
		text-align: center;
		image{
			max-width: 100%;
		}
	}
}
</style>
